package com.kc.sjwh.service;

import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.kc.sjwh.action.CzllyAction;
import com.kc.sjwh.dao.ZykzdDao;
import com.kc.sjwh.entity.po.Zykzd;
import com.kc.sjwh.other.Page;
import com.kc.sjwh.other.QueryParam;

/**
 * 资源库字典
 * @author zhouy
 *
 */
@Service
public class ZykzdService {
	static Logger logger = Logger.getLogger(CzllyAction.class);
	
	@Autowired
	ZykzdDao zykzdDao;
	
	/**
	 * 分页获得资源数据列表
	 * @param p
	 * @return
	 */
	public Page<Zykzd> getData(QueryParam p){
		return zykzdDao.getPage(p);
	}
	
	/**
	 * 编辑对象
	 * @param one
	 * @param key
	 */
	public void editData(Zykzd one, String key){
		zykzdDao.update(one, key);
	}
	
	/**
	 * 新增数据
	 * @param one
	 */
	public void addData(Zykzd one){
		zykzdDao.add(one);
	}
	
	/**
	 * 获得单条数据
	 * @param id
	 * @return
	 */
	public Zykzd getOneInfo(String id){
		QueryParam p = new QueryParam();
		p.addSqlCondition(" t.bh = '" + id + "'");
		return zykzdDao.getOne(p);
	}
	
	/**
	 * 根据条件查询相关内容
	 * @param p
	 * @return
	 */
	public List<Zykzd> getList(QueryParam p){
		return zykzdDao.getList(p);
	}
}
